home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / LinAlg 3.1 / LinAlg / vsvd.dat < prev    next >
Encoding:
Text File  |  1995-12-21  |  30.0 KB  |  616 lines  |  [TEXT/CWIE]

  1.  
  2.  
  3. Testing Singular Value Decompositions of rectangular matrices
  4.  
  5. Rotated by PI/2 Matrix Diag(1,4,9)
  6.  
  7.  
  8.  
  9. SVD-decompose matrix A and check if we can compose it back
  10.  
  11.  
  12. Matrix 3x3 'original matrix' is as follows
  13.  
  14.      |        1  |        2  |        3  |
  15. -------------------------------------------------------------------------------
  16.    1 |          0           -4            0  
  17.    2 |          1            0            0  
  18.    3 |          0            0            9  
  19. Done
  20.  
  21. Matrix 3x3 'left factor U' is as follows
  22.  
  23.      |        1  |        2  |        3  |
  24. -------------------------------------------------------------------------------
  25.    1 |         -0           -1           -0  
  26.    2 |          1           -0           -0  
  27.    3 |          0           -0           -1  
  28. Done
  29.  
  30. Matrix 3x1 'Vector of Singular values' is as follows
  31.  
  32.      |        1  |
  33. -------------------------------------------------------------------------------
  34.    1 |          1  
  35.    2 |          4  
  36.    3 |          9  
  37. Done
  38.  
  39. Matrix 3x3 'right factor V' is as follows
  40.  
  41.      |        1  |        2  |        3  |
  42. -------------------------------------------------------------------------------
  43.    1 |          1            0           -0  
  44.    2 |          0            1           -0  
  45.    3 |          0            0           -1  
  46. Done
  47.     checking that U is orthogonal indeed, i.e., U'U=E and UU'=E
  48.     checking that V is orthogonal indeed, i.e., V'V=E and VV'=E
  49.     checking that U*Sig*V' is indeed A
  50.  
  51.  
  52. Comparison of two Matrices:
  53.     Original A and composed USigV'
  54. Matrix 1:3x1:3 ''
  55. Matrix 1:3x1:3 ''
  56. Maximal discrepancy         0
  57.    occured at the point     (1,1)
  58.  Matrix 1 element is            0
  59.  Matrix 2 element is            0
  60.  Absolute error v2[i]-v1[i]     0
  61.  Relative error             0
  62.  
  63. ||Matrix 1||            14
  64. ||Matrix 2||            14
  65. ||Matrix1-Matrix2||             0
  66. ||Matrix1-Matrix2||/sqrt(||Matrix1|| ||Matrix2||)   0
  67.  
  68.  
  69. Done
  70.  
  71. Example from the Forsythe, Malcolm, Moler's book
  72.  
  73.  
  74.  
  75. SVD-decompose matrix A and check if we can compose it back
  76.  
  77.  
  78. Matrix 5x3 'original matrix' is as follows
  79.  
  80.      |        1  |        2  |        3  |
  81. -------------------------------------------------------------------------------
  82.    1 |          1            6           11  
  83.    2 |          2            7           12  
  84.    3 |          3            8           13  
  85.    4 |          4            9           14  
  86.    5 |          5           10           15  
  87. Done
  88.  
  89. Matrix 5x5 'left factor U' is as follows
  90.  
  91.      |        1  |        2  |        3  |        4  |        5  |
  92. -------------------------------------------------------------------------------
  93.    1 |    -0.3546      -0.6887       0.6179       0.1219     -0.05776  
  94.    2 |    -0.3987      -0.3756      -0.6091      0.07566       0.5685  
  95.    3 |    -0.4428     -0.06242      -0.2338      -0.6969      -0.5095  
  96.    4 |     -0.487       0.2507      -0.1766       0.6792      -0.4555  
  97.    5 |    -0.5311       0.5638       0.4016      -0.1799       0.4542  
  98. Done
  99.  
  100. Matrix 3x1 'Vector of Singular values' is as follows
  101.  
  102.      |        1  |
  103. -------------------------------------------------------------------------------
  104.    1 |      35.13  
  105.    2 |      2.465  
  106.    3 |  1.196e-06  
  107. Done
  108.  
  109. Matrix 3x3 'right factor V' is as follows
  110.  
  111.      |        1  |        2  |        3  |
  112. -------------------------------------------------------------------------------
  113.    1 |    -0.2017       0.8903       0.4082  
  114.    2 |    -0.5168       0.2573      -0.8165  
  115.    3 |     -0.832      -0.3757       0.4082  
  116. Done
  117.     checking that U is orthogonal indeed, i.e., U'U=E and UU'=E
  118. Two (3,3) elements of matrices with values 1 and 1
  119. differ the most, though the deviation 2.38419e-07 is small
  120. Two (2,2) elements of matrices with values 1 and 1
  121. differ the most, though the deviation 4.76837e-07 is small
  122.     checking that V is orthogonal indeed, i.e., V'V=E and VV'=E
  123. Two (1,1) elements of matrices with values 1 and 1
  124. differ the most, though the deviation 3.57628e-07 is small
  125. Two (3,3) elements of matrices with values 1 and 1
  126. differ the most, though the deviation 2.38419e-07 is small
  127.     checking that U*Sig*V' is indeed A
  128.  
  129.  
  130. Comparison of two Matrices:
  131.     Original A and composed USigV'
  132. Matrix 1:5x1:3 ''
  133. Matrix 1:5x1:3 ''
  134. Maximal discrepancy         4.76837e-06
  135.    occured at the point     (2,3)
  136.  Matrix 1 element is            12
  137.  Matrix 2 element is            12
  138.  Absolute error v2[i]-v1[i]     4.76837e-06
  139.  Relative error             3.97364e-07
  140.  
  141. ||Matrix 1||            120
  142. ||Matrix 2||            120
  143. ||Matrix1-Matrix2||             3.27229e-05
  144. ||Matrix1-Matrix2||/sqrt(||Matrix1|| ||Matrix2||)   2.72691e-07
  145.  
  146.  
  147. Done
  148.  
  149. Example from the Wilkinson, Reinsch's book
  150. Singular numbers are 0, 19.5959, 20, 0, 35.3270
  151.  
  152.  
  153.  
  154. SVD-decompose matrix A and check if we can compose it back
  155.  
  156.  
  157. Matrix 8x5 'original matrix' is as follows
  158.  
  159.      |        1  |        2  |        3  |        4  |        5  |
  160. -------------------------------------------------------------------------------
  161.    1 |         22           10            2            3            7  
  162.    2 |         14            7           10            0            8  
  163.    3 |         -1           13           -1          -11            3  
  164.    4 |         -3           -2           13           -2            4  
  165.    5 |          9            8            1           -2            4  
  166.    6 |          9            1           -7            5           -1  
  167.    7 |          2           -6            6            5            1  
  168.    8 |          4            5            0           -2            2  
  169. Done
  170.  
  171. Matrix 8x8 'left factor U' is as follows
  172.  
  173.      |        1  |        2  |        3  |        4  |        5  |        6  |
  174. -------------------------------------------------------------------------------
  175.    1 |    -0.7071      0.04042      -0.1581      -0.1768      -0.2599       -0.556  
  176.    2 |    -0.5303     -0.03117      -0.1581       0.3536        0.235       0.3738  
  177.    3 |    -0.1768       0.3032       0.7906       0.1768       0.3747     -0.08507  
  178.    4 |   3.62e-08       0.2239      -0.1581       0.7071      -0.4142       0.2025  
  179.    5 |    -0.3536      -0.6346       0.1581    2.628e-07      0.08927       0.2987  
  180.    6 |    -0.1768       0.4394      -0.1581      -0.5303      0.04782       0.5935  
  181.    7 |  1.374e-08       0.2224      -0.4743       0.1768       0.6957      -0.2479  
  182.    8 |    -0.1768       0.4584       0.1581    2.357e-07      -0.2665    -0.003315  
  183.  
  184.  
  185.      |        7  |        8  |
  186. -------------------------------------------------------------------------------
  187.    1 |     0.0214       -0.255  
  188.    2 |     -0.571       0.2163  
  189.    3 |    0.03519      -0.2678  
  190.    4 |     0.2985      -0.3511  
  191.    5 |      0.585      0.08857  
  192.    6 |     0.1483      -0.3047  
  193.    7 |     0.3793      0.07015  
  194.    8 |     0.2739       0.7665  
  195. Done
  196.  
  197. Matrix 5x1 'Vector of Singular values' is as follows
  198.  
  199.      |        1  |
  200. -------------------------------------------------------------------------------
  201.    1 |      35.33  
  202.    2 |  3.767e-07  
  203.    3 |         20  
  204.    4 |       19.6  
  205.    5 |  6.981e-07  
  206. Done
  207.  
  208. Matrix 5x5 'right factor V' is as follows
  209.  
  210.      |        1  |        2  |        3  |        4  |        5  |
  211. -------------------------------------------------------------------------------
  212.    1 |    -0.8006       0.4191      -0.3162      -0.2887            0  
  213.    2 |    -0.4804      -0.4405       0.6325    9.471e-07      -0.4185  
  214.    3 |    -0.1601        0.052      -0.3162        0.866      -0.3488  
  215.    4 | -8.859e-09      -0.6761      -0.6325      -0.2887      -0.2442  
  216.    5 |    -0.3203       -0.413   -3.532e-07       0.2887       0.8022  
  217. Done
  218.     checking that U is orthogonal indeed, i.e., U'U=E and UU'=E
  219. Two (4,4) elements of matrices with values 1 and 1
  220. differ the most, though the deviation 2.38419e-07 is small
  221. Two (1,1) elements of matrices with values 1 and 1
  222. differ the most, though the deviation 2.38419e-07 is small
  223.     checking that V is orthogonal indeed, i.e., V'V=E and VV'=E
  224. Two (4,4) elements of matrices with values 1 and 1
  225. differ the most, though the deviation 3.57628e-07 is small
  226. Two (3,3) elements of matrices with values 1 and 1
  227. differ the most, though the deviation 4.76837e-07 is small
  228.     checking that U*Sig*V' is indeed A
  229.  
  230.  
  231. Comparison of two Matrices:
  232.     Original A and composed USigV'
  233. Matrix 1:8x1:5 ''
  234. Matrix 1:8x1:5 ''
  235. Maximal discrepancy         0.000317216
  236.    occured at the point     (5,4)
  237.  Matrix 1 element is            -2
  238.  Matrix 2 element is            -1.99968
  239.  Absolute error v2[i]-v1[i]     0.000317216
  240.  Relative error             0.000158621
  241.  
  242. ||Matrix 1||            216
  243. ||Matrix 2||            216
  244. ||Matrix1-Matrix2||             0.00353294
  245. ||Matrix1-Matrix2||/sqrt(||Matrix1|| ||Matrix2||)   1.63562e-05
  246.  
  247.  
  248. Done
  249.  
  250. Example from the Wilkinson, Reinsch's book
  251. Ordered singular numbers are Sig[21-k] = sqrt(k*(k-1))
  252.  
  253.  
  254.  
  255. SVD-decompose matrix A and check if we can compose it back
  256.  
  257.  
  258. Matrix 21x20 'original matrix' is as follows
  259.  
  260.      |        1  |        2  |        3  |        4  |        5  |        6  |
  261. -------------------------------------------------------------------------------
  262.    1 |         20            0            0            0            0            0  
  263.    2 |         -1           19            0            0            0            0  
  264.    3 |         -1           -1           18            0            0            0  
  265.    4 |         -1           -1           -1           17            0            0  
  266.    5 |         -1           -1           -1           -1           16            0  
  267.    6 |         -1           -1           -1           -1           -1           15  
  268.    7 |         -1           -1           -1           -1           -1           -1  
  269.    8 |         -1           -1           -1           -1           -1           -1  
  270.    9 |         -1           -1           -1           -1           -1           -1  
  271.   10 |         -1           -1           -1           -1           -1           -1  
  272.   11 |         -1           -1           -1           -1           -1           -1  
  273.   12 |         -1           -1           -1           -1           -1           -1  
  274.   13 |         -1           -1           -1           -1           -1           -1  
  275.   14 |         -1           -1           -1           -1           -1           -1  
  276.   15 |         -1           -1           -1           -1           -1           -1  
  277.   16 |         -1           -1           -1           -1           -1           -1  
  278.   17 |         -1           -1           -1           -1           -1           -1  
  279.   18 |         -1           -1           -1           -1           -1           -1  
  280.   19 |         -1           -1           -1           -1           -1           -1  
  281.   20 |         -1           -1           -1           -1           -1           -1  
  282.   21 |         -1           -1           -1           -1           -1           -1  
  283.  
  284.  
  285.      |        7  |        8  |        9  |       10  |       11  |       12  |
  286. -------------------------------------------------------------------------------
  287.    1 |          0            0            0            0            0            0  
  288.    2 |          0            0            0            0            0            0  
  289.    3 |          0            0            0            0            0            0  
  290.    4 |          0            0            0            0            0            0  
  291.    5 |          0            0            0            0            0            0  
  292.    6 |          0            0            0            0            0            0  
  293.    7 |         14            0            0            0            0            0  
  294.    8 |         -1           13            0            0            0            0  
  295.    9 |         -1           -1           12            0            0            0  
  296.   10 |         -1           -1           -1           11            0            0  
  297.   11 |         -1           -1           -1           -1           10            0  
  298.   12 |         -1           -1           -1           -1           -1            9  
  299.   13 |         -1           -1           -1           -1           -1           -1  
  300.   14 |         -1           -1           -1           -1           -1           -1  
  301.   15 |         -1           -1           -1           -1           -1           -1  
  302.   16 |         -1           -1           -1           -1           -1           -1  
  303.   17 |         -1           -1           -1           -1           -1           -1  
  304.   18 |         -1           -1           -1           -1           -1           -1  
  305.   19 |         -1           -1           -1           -1           -1           -1  
  306.   20 |         -1           -1           -1           -1           -1           -1  
  307.   21 |         -1           -1           -1           -1           -1           -1  
  308.  
  309.  
  310.      |       13  |       14  |       15  |       16  |       17  |       18  |
  311. -------------------------------------------------------------------------------
  312.    1 |          0            0            0            0            0            0  
  313.    2 |          0            0            0            0            0            0  
  314.    3 |          0            0            0            0            0            0  
  315.    4 |          0            0            0            0            0            0  
  316.    5 |          0            0            0            0            0            0  
  317.    6 |          0            0            0            0            0            0  
  318.    7 |          0            0            0            0            0            0  
  319.    8 |          0            0            0            0            0            0  
  320.    9 |          0            0            0            0            0            0  
  321.   10 |          0            0            0            0            0            0  
  322.   11 |          0            0            0            0            0            0  
  323.   12 |          0            0            0            0            0            0  
  324.   13 |          8            0            0            0            0            0  
  325.   14 |         -1            7            0            0            0            0  
  326.   15 |         -1           -1            6            0            0            0  
  327.   16 |         -1           -1           -1            5            0            0  
  328.   17 |         -1           -1           -1           -1            4            0  
  329.   18 |         -1           -1           -1           -1           -1            3  
  330.   19 |         -1           -1           -1           -1           -1           -1  
  331.   20 |         -1           -1           -1           -1           -1           -1  
  332.   21 |         -1           -1           -1           -1           -1           -1  
  333.  
  334.  
  335.      |       19  |       20  |
  336. -------------------------------------------------------------------------------
  337.    1 |          0            0  
  338.    2 |          0            0  
  339.    3 |          0            0  
  340.    4 |          0            0  
  341.    5 |          0            0  
  342.    6 |          0            0  
  343.    7 |          0            0  
  344.    8 |          0            0  
  345.    9 |          0            0  
  346.   10 |          0            0  
  347.   11 |          0            0  
  348.   12 |          0            0  
  349.   13 |          0            0  
  350.   14 |          0            0  
  351.   15 |          0            0  
  352.   16 |          0            0  
  353.   17 |          0            0  
  354.   18 |          0            0  
  355.   19 |          2            0  
  356.   20 |         -1            1  
  357.   21 |         -1           -1  
  358. Done
  359.  
  360. Matrix 21x21 'left factor U' is as follows
  361.  
  362.      |        1  |        2  |        3  |        4  |        5  |        6  |
  363. -------------------------------------------------------------------------------
  364.    1 |    -0.9759    -3.71e-08    3.457e-08   -2.125e-08    3.696e-09   -4.577e-09  
  365.    2 |     0.0488      -0.9747    -4.26e-07   -9.356e-08    1.289e-07    1.485e-07  
  366.    3 |     0.0488       0.0513       0.9733   -1.963e-07   -2.769e-07   -6.716e-08  
  367.    4 |     0.0488       0.0513     -0.05407      -0.9718    4.383e-06    -5.87e-07  
  368.    5 |     0.0488       0.0513     -0.05407      0.05717       0.9701   -4.123e-07  
  369.    6 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      -0.9682  
  370.    7 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  371.    8 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  372.    9 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  373.   10 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  374.   11 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  375.   12 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  376.   13 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  377.   14 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  378.   15 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  379.   16 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  380.   17 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  381.   18 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  382.   19 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  383.   20 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  384.   21 |     0.0488       0.0513     -0.05407      0.05717     -0.06063      0.06455  
  385.  
  386.  
  387.      |        7  |        8  |        9  |       10  |       11  |       12  |
  388. -------------------------------------------------------------------------------
  389.    1 |  2.205e-08   -1.524e-08    2.213e-08    4.369e-09    4.789e-09   -3.074e-08  
  390.    2 |  3.658e-07   -9.071e-08    1.473e-07   -1.616e-07   -1.239e-08   -3.136e-08  
  391.    3 |    1.7e-07   -2.258e-07    -3.62e-09    7.857e-08   -2.353e-08   -8.503e-08  
  392.    4 |  1.514e-08   -2.308e-08   -5.589e-08    2.104e-07    5.449e-08     -4.6e-08  
  393.    5 |   1.72e-07    2.004e-07   -1.102e-07    3.531e-08   -7.034e-08   -5.764e-08  
  394.    6 | -8.348e-07   -2.774e-07    1.378e-07   -1.164e-07   -2.009e-07   -2.639e-07  
  395.    7 |     0.9661   -4.422e-07    1.893e-07    9.333e-08     4.94e-08     7.79e-08  
  396.    8 |   -0.06901      -0.9636   -1.097e-06    1.028e-06    2.331e-07    1.367e-08  
  397.    9 |   -0.06901      0.07412       0.9608    4.235e-08    4.178e-08    4.608e-08  
  398.   10 |   -0.06901      0.07412     -0.08006      -0.9574   -4.451e-10   -7.229e-08  
  399.   11 |   -0.06901      0.07413     -0.08006      0.08704    7.009e-08   -1.185e-08  
  400.   12 |   -0.06901      0.07413     -0.08006      0.08704   -5.234e-08    4.453e-08  
  401.   13 |   -0.06901      0.07413     -0.08006      0.08704   -1.229e-07   -5.138e-08  
  402.   14 |   -0.06901      0.07413     -0.08006      0.08704   -1.563e-07   -7.388e-08  
  403.   15 |   -0.06901      0.07413     -0.08006      0.08704    2.603e-07   -2.198e-07  
  404.   16 |   -0.06901      0.07413     -0.08006      0.08704   -1.286e-07    8.494e-07  
  405.   17 |   -0.06901      0.07413     -0.08006      0.08704   -4.584e-07       0.8944  
  406.   18 |   -0.06901      0.07413     -0.08006      0.08704        0.866      -0.2236  
  407.   19 |   -0.06901      0.07413     -0.08006      0.08704      -0.2887      -0.2236  
  408.   20 |   -0.06901      0.07413     -0.08006      0.08704      -0.2887      -0.2236  
  409.   21 |   -0.06901      0.07413     -0.08006      0.08704      -0.2887      -0.2236  
  410.  
  411.  
  412.      |       13  |       14  |       15  |       16  |       17  |       18  |
  413. -------------------------------------------------------------------------------
  414.    1 |  4.834e-09   -5.117e-09   -3.424e-09    -1.14e-08    1.085e-08    1.896e-08  
  415.    2 |  1.005e-07    7.063e-08    6.547e-09    2.318e-08    3.477e-08   -1.866e-08  
  416.    3 | -1.242e-08    2.872e-08    -1.05e-08   -6.217e-08   -1.651e-08    5.811e-08  
  417.    4 |  -1.01e-07   -4.904e-08   -5.367e-09    1.203e-08   -3.832e-08    5.225e-08  
  418.    5 | -7.227e-08    6.163e-08    2.908e-08    1.029e-07    2.881e-08   -4.705e-08  
  419.    6 |  2.437e-08    2.404e-07    1.806e-07    5.632e-08    9.787e-08    4.172e-08  
  420.    7 |  4.846e-08     4.16e-08    1.024e-08   -4.522e-08     1.37e-07   -6.724e-08  
  421.    8 |  2.318e-07    1.915e-08    1.703e-07    4.187e-08   -3.731e-08      3.2e-08  
  422.    9 | -1.212e-07   -1.046e-08    2.008e-08     1.07e-07    9.472e-08    9.679e-08  
  423.   10 |  -3.45e-07    6.052e-08    3.378e-08   -3.086e-08     7.88e-08   -1.434e-07  
  424.   11 |     0.9535    5.978e-08    1.087e-07    -2.18e-07   -4.499e-07    2.712e-07  
  425.   12 |   -0.09535   -1.049e-08    1.113e-07   -1.616e-07    5.878e-07      -0.9487  
  426.   13 |   -0.09535   -8.414e-08   -1.979e-08     2.18e-08       0.9428       0.1054  
  427.   14 |   -0.09535    -1.97e-07   -1.908e-07       0.9354      -0.1179       0.1054  
  428.   15 |   -0.09535   -3.364e-07      -0.9258      -0.1336      -0.1179       0.1054  
  429.   16 |   -0.09535      -0.9129       0.1543      -0.1336      -0.1179       0.1054  
  430.   17 |   -0.09535       0.1826       0.1543      -0.1336      -0.1179       0.1054  
  431.   18 |   -0.09535       0.1826       0.1543      -0.1336      -0.1179       0.1054  
  432.   19 |   -0.09535       0.1826       0.1543      -0.1336      -0.1179       0.1054  
  433.   20 |   -0.09535       0.1826       0.1543      -0.1336      -0.1179       0.1054  
  434.   21 |   -0.09535       0.1826       0.1543      -0.1336      -0.1179       0.1054  
  435.  
  436.  
  437.      |       19  |       20  |       21  |
  438. -------------------------------------------------------------------------------
  439.    1 |  1.797e-08   -1.015e-08       0.2182  
  440.    2 |  8.091e-09   -1.579e-08       0.2182  
  441.    3 |  8.091e-09   -1.579e-08       0.2182  
  442.    4 | -1.183e-08   -3.978e-09       0.2182  
  443.    5 | -1.183e-08   -3.978e-09       0.2182  
  444.    6 | -1.956e-09   -1.421e-09       0.2182  
  445.    7 |  8.091e-09   -1.579e-08       0.2182  
  446.    8 | -1.871e-09   -1.888e-08       0.2182  
  447.    9 | -1.871e-09   -1.888e-08       0.2182  
  448.   10 |  1.295e-08   -2.249e-08       0.2182  
  449.   11 |  1.797e-08   -1.015e-08       0.2182  
  450.   12 |  1.797e-08   -1.015e-08       0.2182  
  451.   13 | -1.956e-09   -1.421e-09       0.2182  
  452.   14 |  1.309e-09   -1.377e-08       0.2182  
  453.   15 |  3.068e-09   -7.064e-09       0.2182  
  454.   16 |  3.068e-09   -7.064e-09       0.2182  
  455.   17 |  2.785e-08   -2.558e-08       0.2182  
  456.   18 | -1.871e-09   -1.888e-08       0.2182  
  457.   19 |    -0.8165   -7.064e-09       0.2182  
  458.   20 |     0.4082      -0.7071       0.2182  
  459.   21 |     0.4082       0.7071       0.2182  
  460. Done
  461.  
  462. Matrix 20x1 'Vector of Singular values' is as follows
  463.  
  464.      |        1  |
  465. -------------------------------------------------------------------------------
  466.    1 |      20.49  
  467.    2 |      19.49  
  468.    3 |      18.49  
  469.    4 |      17.49  
  470.    5 |      16.49  
  471.    6 |      15.49  
  472.    7 |      14.49  
  473.    8 |      13.49  
  474.    9 |      12.49  
  475.   10 |      11.49  
  476.   11 |      3.464  
  477.   12 |      4.472  
  478.   13 |      10.49  
  479.   14 |      5.477  
  480.   15 |      6.481  
  481.   16 |      7.483  
  482.   17 |      8.485  
  483.   18 |      9.487  
  484.   19 |      2.449  
  485.   20 |      1.414  
  486. Done
  487.  
  488. Matrix 20x20 'right factor V' is as follows
  489.  
  490.      |        1  |        2  |        3  |        4  |        5  |        6  |
  491. -------------------------------------------------------------------------------
  492.    1 |         -1            0            0            0            0            0  
  493.    2 |         -0           -1   -5.817e-07   -7.803e-08    1.099e-07    2.885e-07  
  494.    3 |         -0   -5.496e-07            1     1.15e-08   -3.019e-07   -1.222e-07  
  495.    4 |         -0    1.103e-07    1.621e-08           -1    4.604e-06   -6.565e-07  
  496.    5 |         -0     1.84e-07    2.881e-07    4.468e-06            1    -1.81e-07  
  497.    6 |         -0   -2.145e-07   -1.894e-07    7.164e-07    -1.62e-07           -1  
  498.    7 |         -0    3.567e-07    5.349e-08    2.193e-07   -5.714e-07   -6.475e-07  
  499.    8 |         -0      6.9e-08   -1.494e-07   -8.144e-09    1.447e-07    3.973e-07  
  500.    9 |         -0    1.437e-07    2.367e-08   -1.971e-07    1.299e-07    4.323e-07  
  501.   10 |         -0    1.291e-07    5.721e-08   -1.891e-07    6.162e-08    2.174e-07  
  502.   11 |         -0    8.714e-08    3.196e-08   -9.906e-08   -2.361e-09    4.867e-08  
  503.   12 |         -0    3.968e-08    2.551e-08    -4.65e-08   -4.184e-08   -2.511e-08  
  504.   13 |         -0    3.433e-08    3.698e-08   -6.459e-08   -4.624e-08   -4.783e-08  
  505.   14 |         -0     2.71e-08    9.507e-08    4.545e-08     -3.8e-08   -4.067e-08  
  506.   15 |         -0   -1.515e-08    4.369e-08   -1.674e-08   -8.229e-08    2.892e-08  
  507.   16 |         -0   -5.691e-08    1.634e-09    8.014e-08   -7.747e-08   -7.917e-08  
  508.   17 |         -0    2.758e-08    5.199e-08   -6.585e-08   -9.886e-08    -1.47e-07  
  509.   18 |         -0   -2.051e-08    7.765e-08    1.291e-07    1.727e-08   -3.913e-08  
  510.   19 |         -0            0            0            0            0            0  
  511.   20 |         -0            0            0            0            0            0  
  512.  
  513.  
  514.      |        7  |        8  |        9  |       10  |       11  |       12  |
  515. -------------------------------------------------------------------------------
  516.    1 |          0            0            0            0           -0            0  
  517.    2 |  3.214e-07    -7.08e-08    1.037e-07   -1.189e-07    -2.31e-08    1.533e-08  
  518.    3 |  2.078e-07   -1.522e-07   -7.362e-09    7.377e-08   -2.312e-08   -5.101e-08  
  519.    4 |  1.123e-07    1.008e-07   -1.379e-07    1.861e-07   -4.093e-08   -6.498e-08  
  520.    5 |  3.374e-07    7.267e-08   -6.264e-08    2.724e-09   -5.436e-09    7.541e-09  
  521.    6 | -6.075e-07   -3.378e-07    3.189e-07   -9.283e-08   -5.966e-08   -2.612e-08  
  522.    7 |          1   -4.409e-07   -7.129e-10     5.06e-08   -3.927e-08    1.552e-07  
  523.    8 | -4.823e-07           -1   -1.115e-06    1.071e-06    2.378e-07   -1.276e-08  
  524.    9 |  8.088e-09   -1.192e-06            1    9.116e-08   -2.033e-08    1.381e-07  
  525.   10 |   2.53e-08   -1.137e-06    1.323e-07           -1    1.662e-09   -2.731e-09  
  526.   11 |  2.685e-08    3.582e-07    1.613e-07   -4.709e-07   -4.404e-08    6.036e-08  
  527.   12 |   -3.3e-08    1.358e-08     5.25e-08    3.828e-08     1.56e-08    -7.43e-08  
  528.   13 | -9.171e-08     -1.4e-07   -1.209e-07    1.995e-07   -8.345e-08   -6.239e-08  
  529.   14 | -1.732e-08   -4.921e-08    -1.28e-07   -3.162e-08   -1.658e-07   -2.247e-08  
  530.   15 |  4.594e-08   -6.549e-08   -4.467e-08   -2.677e-07    1.799e-07   -1.616e-07  
  531.   16 |  1.761e-08    6.723e-08   -1.042e-07   -4.106e-07   -1.975e-07    8.867e-07  
  532.   17 | -1.326e-07   -1.844e-08    9.188e-08    -1.46e-08   -5.492e-07            1  
  533.   18 |  7.881e-08    2.892e-07    6.171e-08    1.276e-07            1    7.466e-07  
  534.   19 |          0            0            0            0           -0            0  
  535.   20 |          0            0            0            0           -0            0  
  536.  
  537.  
  538.      |       13  |       14  |       15  |       16  |       17  |       18  |
  539. -------------------------------------------------------------------------------
  540.    1 |          0            0           -0           -0            0            0  
  541.    2 |  9.778e-08    3.192e-08    1.489e-08    2.463e-08    2.958e-08   -3.491e-08  
  542.    3 | -5.103e-08    3.163e-08    6.803e-08    -7.59e-08   -1.536e-08     3.75e-08  
  543.    4 | -2.467e-07    -1.19e-07   -3.786e-08   -1.589e-08   -9.788e-08    6.379e-08  
  544.    5 |   1.63e-08    6.172e-08   -7.454e-08    1.963e-08    -5.44e-08    1.749e-08  
  545.    6 |  1.234e-07   -2.641e-08   -6.771e-08   -5.796e-08    -9.13e-09   -2.699e-08  
  546.    7 | -5.995e-08    5.726e-08    6.742e-08   -1.522e-08    6.852e-08   -3.192e-08  
  547.    8 |  2.723e-07   -1.519e-07   -2.498e-08   -2.589e-08   -3.785e-08   -3.424e-08  
  548.    9 | -1.884e-07   -1.534e-07   -5.107e-08    1.103e-07    1.845e-07     4.28e-08  
  549.   10 | -5.213e-07    3.332e-07    2.591e-07    6.569e-08    8.989e-08   -9.429e-08  
  550.   11 |          1    5.257e-08    5.318e-08   -1.435e-07   -3.915e-07    2.351e-07  
  551.   12 |  2.476e-07   -7.475e-08    1.837e-07   -2.188e-07    6.622e-07           -1  
  552.   13 |   5.79e-07    5.375e-08   -1.525e-07    1.544e-07            1    6.557e-07  
  553.   14 |  2.548e-07   -1.933e-07   -6.224e-08            1   -1.377e-07    -9.73e-08  
  554.   15 |  1.421e-07    -3.11e-07           -1    7.571e-08   -8.913e-08   -7.328e-08  
  555.   16 |  1.961e-09           -1    4.069e-07   -2.754e-07    7.475e-09    9.918e-08  
  556.   17 | -9.992e-08    9.152e-07   -3.149e-07    1.621e-08    2.908e-08   -1.064e-07  
  557.   18 |  8.998e-08   -3.906e-07    1.229e-07    1.479e-07     1.33e-07   -3.624e-08  
  558.   19 |          0            0           -0           -0            0            0  
  559.   20 |          0            0           -0           -0            0            0  
  560.  
  561.  
  562.      |       19  |       20  |
  563. -------------------------------------------------------------------------------
  564.    1 |         -0           -0  
  565.    2 |          0            0  
  566.    3 |          0            0  
  567.    4 |          0            0  
  568.    5 |          0            0  
  569.    6 |          0            0  
  570.    7 |          0            0  
  571.    8 |          0            0  
  572.    9 |          0            0  
  573.   10 |          0            0  
  574.   11 |          0            0  
  575.   12 |          0            0  
  576.   13 |          0            0  
  577.   14 |          0            0  
  578.   15 |          0            0  
  579.   16 |          0            0  
  580.   17 |          0            0  
  581.   18 |          0            0  
  582.   19 |         -1           -0  
  583.   20 |         -0           -1  
  584. Done
  585.     checking that U is orthogonal indeed, i.e., U'U=E and UU'=E
  586. Two (17,17) elements of matrices with values 1 and 1
  587. differ the most, though the deviation 5.96046e-07 is small
  588. Two (13,13) elements of matrices with values 1 and 1
  589. differ the most, though the deviation 5.96046e-07 is small
  590.     checking that V is orthogonal indeed, i.e., V'V=E and VV'=E
  591. Two (13,13) elements of matrices with values 0.999999 and 1
  592. differ the most, though the deviation 5.96046e-07 is small
  593. Two (11,11) elements of matrices with values 0.999999 and 1
  594. differ the most, though the deviation 5.96046e-07 is small
  595.     checking that U*Sig*V' is indeed A
  596.  
  597.  
  598. Comparison of two Matrices:
  599.     Original A and composed USigV'
  600. Matrix 1:21x1:20 ''
  601. Matrix 1:21x1:20 ''
  602. Maximal discrepancy         7.62939e-06
  603.    occured at the point     (4,4)
  604.  Matrix 1 element is            17
  605.  Matrix 2 element is            17
  606.  Absolute error v2[i]-v1[i]     -7.62939e-06
  607.  Relative error             -4.48788e-07
  608.  
  609. ||Matrix 1||            420
  610. ||Matrix 2||            420
  611. ||Matrix1-Matrix2||             0.000381902
  612. ||Matrix1-Matrix2||/sqrt(||Matrix1|| ||Matrix2||)   9.09289e-07
  613.  
  614.  
  615. Done
  616.